<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@page import="com.Dao.SubDao"%>
<%@page import="com.pojo.Sub"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>HI视角| HI社区</title>

<link rel="stylesheet" type="text/css"
	href="./HI-files/css/candy-box.css">
<link rel="stylesheet" type="text/css"
	href="./HI-files/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css"
	href="./HI-files/css/animate.min.css">
<link rel="stylesheet" type="text/css"
	href="./HI-files/css/jquery.skippr.css">
<link rel="stylesheet" type="text/css" href="./HI-files/css/style.css">
<style type="text/css">
#frameContent {
	/*调整显示区的宽*/
	height: 1040px; /*调整显示区的高*/
	overflow-pageINdex: hidden;
	overflow-y: hidden;
	word-break: break-all;
}
</style>
</head>
<body style="">
<%String address ="./HI_scenery.jsp";
session.setAttribute("address",address);%>
	<%@ include file="./include/header.jsp"%>
	<section class="view-header">
		<div class="container">
			<div class="row">
				<div class="col-sm-8" style="margin: 0; padding: 0px 0px 0px 15px;">
					<a href="#">
						<div class="gallery-item" style="height: 400px; overflow: hidden;">
							<img src="./HI-files/images/mj3.jpg" class="img-responsive">
							<div class="info">
								<div class="info-con">
									<h3>标题</h3>
									<p>文章摘要内容，可只显示指定字节的内容</p>
								</div>
							</div>
							<div class="img-caption">
								<h3>标题</h3>
								<p>2015-7-15</p>
							</div>
						</div>
					</a>
				</div>
				<div class="col-sm-4" style="margin: 0; padding: 0px 15px 0px 0px;">
					<div class="col-sm-12" style="margin: 0; padding: 0px;">
						<a href="#">
							<div class="gallery-item"
								style="height: 200px; overflow: hidden;">
								<img src="./HI-files/images/mj2.jpg" class="img-responsive">
								<div class="info">
									<div class="info-con">
										<h3>标题</h3>
										<p>文章摘要内容，可只显示指定字节的内容</p>
									</div>
								</div>
								<div class="img-caption">
									<h3>标题</h3>
									<p>2015-7-15</p>
								</div>
							</div>
						</a>
					</div>
					<div class="col-sm-12" style="margin: 0; padding: 0px;">
						<a href="#">
							<div class="gallery-item"
								style="height: 200px; overflow: hidden;">
								<img src="./HI-files/images/mj1.jpg" class="img-responsive">
								<div class="info">
									<div class="info-con">
										<h3>我要发帖</h3>
									</div>
								</div>
								<div class="img-caption">
									<h3>你有什么嗨玩意儿</h3>
									<p>分享出来吧！</p>
									<%if((User)session.getAttribute("user")!= null){ 
										
										if(((User)session.getAttribute("user")).getUjst().equals("封禁账户")){%>
										<h3>账号已被封禁，禁止发帖</h3>
										<%
											} 
										else{
										%>
										<a href="${pageContext.request.contextPath}/sendcards/sendcards.jsp"><h3>点我去发帖</h3></a>					
										<%
										   } 
									}
						else{
						%>		
								<a href="./login/login.jsp">点击登录发帖</a>
						<%
						}
						%>
						
									
								</div>
							</div>
						</a>
					</div>
				</div>
			</div>
		</div>
	</section>
	<section class="view-content">
		<div class="container">
			<div class="row">
				<h1>所有发帖</h1>
				<div id="frameContent" class="col-sm-8">

					<%
						String theme = "美景";
						SubDao SubDao = new SubDao();
						Sub[] subArr = SubDao.findall(theme);
						for (int i = 0; i < SubDao.getSubCount(); i++) {
					%>
					<div class="view-content-left animated bounceIn"
						data-animation="bounceIn" data-delay="0" style="opacity: 0;">
						<a href="text.jsp?SId=<%=subArr[i].getSId()%>">
							<div class="gallery-item">
								<img src="./HI-files/images/<%=subArr[i].getImg()%>"
									class="img-responsive">
								<div class="info">
									<div class="info-con"><%=subArr[i].getTheme()%></div>
								</div>
							</div>
						</a>
						<div class="content1">
							<h4>
								<a href="text.jsp?SId=<%=subArr[i].getSId()%>"><%=subArr[i].getTitlel()%></a>
							</h4>
							<p><%=subArr[i].getContant()%></p>
							<span class="pull-left"><%=subArr[i].getTime()%></span> <span
								class="pull-right"><%=subArr[i].getReply()%>条评论</span>
								<%if((User)session.getAttribute("user")!= null){ 
								if(((User)session.getAttribute("user")).getUjst().equals("超级管理员")){%>
								<div style="margin-left: 90%;">
								<a href="${pageContext.request.contextPath}/controller/delete.jsp?SId=<%=subArr[i].getSId()%>" style="color:red;" >删除</a>
								</div>
								<%
									} 
								else if(((User)session.getAttribute("user")).getUjst().equals("美景版主")){%>
									<div style="margin-left: 90%;">
									<a href="${pageContext.request.contextPath}/controller/delete.jsp?SId=<%=subArr[i].getSId()%>" style="color:red;">删除</a>
									</div><%
									}
								else{
								
								   } 
								}
								else{
									
								}
								   %>
						</div>
						<div class="clearfix"></div>
					</div>
					<%
						}
					%>
				</div>
				<div class="col-sm-4">
					<div class="view-content-right">
						<h1>热门文章</h1>
						<div class="aside-top">
							<a href="#"><img src="./HI-files/images/img1.jpg"
								style="float: left; height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">2015应该学习的前端语言与框架</a>
							<a href="#"><img src="./HI-files/images/img2.jpg"
								style="float: left; height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">看看硅谷的科技企业是如何开除员工的</a>
							<a href="#"><img src="./HI-files/images/img3.jpg"
								style="float: left; height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">大圣归来
								三里屯优衣库试衣间是怎么刷爆朋友圈的</a> <a href="#"><img
								src="./HI-files/images/img4.jpg"
								style="float: left; height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">不要被VR的火热骗了
								至少现在它还真没什么卵用</a>
						</div>
					</div>
					<div class="view-content-right" style="margin: 20px 0;">
						<img src="./HI-files/images/img5.jpg" class="img-responsive">
					</div>

					<div class="view-content-right">
						<h1>其他文章</h1>
						<div class="aside-top">
							<a href="#"><img src="./HI-files/images/img1.jpg"
								style="height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">2015应该学习的前端语言与框架</a>
							<a href="#"><img src="./HI-files/images/img2.jpg"
								style="height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">2015应该学习的前端语言与框架</a>
							<a href="#"><img src="./HI-files/images/img3.jpg"
								style="height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">2015应该学习的前端语言与框架</a>
							<a href="#"><img src="./HI-files/images/img4.jpg"
								style="height: 40px; width: 40px; border-radius: 50%; margin-right: 15px">2015应该学习的前端语言与框架</a>
						</div>
					</div>
				</div>
			</div>
			<div id="pages"
				style="font-size: 12px; width: 605px; line-height: 40px; text-align: center;"></div>
		</div>
	</section>
	<%@ include file="./include/footer.jsp"%>
	<script type="text/javascript" src="./HI-files/js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="./HI-files/js/bootstrap.min.js"></script>
	<script src="./HI-files/js/jquery.skippr.min.js"></script>
	<script src="./HI-files/js/jquery.scrollto.min.js"></script>
	<script src="./HI-files/js/jquery.easing.min.js"></script>
	<script src="./HI-files/js/jquery.parallax-1.1.3.js"
		type="text/javascript"></script>
	<script type="text/javascript" src="./HI-files/js/main.js"></script>
	<script>
var obj = document.getElementById("frameContent");  //获取内容层
var pages = document.getElementById("pages");         //获取翻页层
var pgindex=1;                                      //当前页
window.onload = function()                             //重写窗体加载的事件
{
var allpages = Math.ceil(parseInt(obj.scrollHeight)/parseInt(obj. offsetHeight));//获取页面数量
    pages.innerHTML = "<b>共"+allpages+"页</b> ";     //输出页面数量
for (var i=1;i<=allpages;i++){
        pages.innerHTML += "<a href=\"javascript:showPage('"+i+"');\">第"+i+"页</a> ";
//循环输出第几页
    }
 pages.innerHTML += " <a href=\"javascript:gotopage('-1');\">上一页</a>  <a href=\"javascript:gotopage('1');\">下一页</a>"
}
function gotopage(value){
try{
 value=="-1"?showPage(pgindex-1):showPage(pgindex+1);
 }catch(e){
 
 }
}
function showPage(pageINdex)
{
    
 obj.scrollTop=(pageINdex-1)*parseInt(obj.offsetHeight);                                                                  //根据高度，输出指定的页
 pgindex=pageINdex;
}
</script>
</body>
</html>